package com.frank.oj.service.entity.common.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.frank.model.entity.common.Announcement;
import com.frank.oj.mapper.AnnouncementMapper;
import com.frank.oj.model.vo.AnnouncementVO;
import com.frank.oj.service.entity.common.AnnouncementEntityService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @author frank
 * @Date 2024/1/25
 */
@Service
public class AnnouncementEntityServiceImpl extends ServiceImpl<AnnouncementMapper, Announcement> implements AnnouncementEntityService {
    @Resource
    private AnnouncementMapper announcementMapper;
    @Override
    public IPage<AnnouncementVO> getAnnouncementList(Integer limit, Integer currentPage, boolean notAdmin) {
        Page<AnnouncementVO> page = new Page<>(currentPage, limit);
        return announcementMapper.getAnnouncementList(page, notAdmin);
    }

    @Override
    public IPage<AnnouncementVO> getContestAnnouncement(Long cid, boolean notAdmin, Integer limit, Integer currentPage) {

        Page<AnnouncementVO> page = new Page<>(currentPage, limit);
        return announcementMapper.getContestAnnouncement(page,cid,notAdmin);
    }
}
